<!-- home组件  -->
<template>
  <div>
    <!-- 商品分类导航 -->
    <TypeNav />
    <!--列表-->
    <ListContainer />
    <!--今日推荐-->
    <TodayRecommend />
    <!-- 商品排行 -->
    <Rank />
    <!-- 猜你喜欢 -->
    <Like />
    <!--楼层  有2个 prop数据传入到floor组件中-->
    <Floor v-for="(floor, index) in floors" :key="index" :floor="floor" />
    <!--商标-->
    <Brand />
  </div>
</template>

<script>
//引入封装后注册的组件
import components from "./components";
//引入vuex，获取state数据
import { mapState } from "vuex";

export default {
  name: "Home",
  data() {
    return {};
  },
  components,
  computed: {
    ...mapState({
      floors: (state) => state.home.floors,
    }),
  },
  methods: {},
  mounted() {
    //在这里获取轮播图
    this.$store.dispatch("getBanners");
    //在这里获取楼层数据
    this.$store.dispatch("getFloors");
  },
};
</script>
<style lang='less' scoped>
</style>